package com.semis.common.enums;

import java.util.stream.Stream;

/**
 * 报警的处理类型
 */
public enum WorkAlarmDealType {

    /**
     * 未处理
     */
    NO_DEAL("0", "未处理"),
    /**
     * 记录为报警
     */
    RECORD("1", "记录"),
    /**
     * 误报
     */
    MISS_ALART("2", "误报"),
    /**
     * 不需要再报警
     */
    NOT_ALART("3", "不再报警"),
    /**
     * 自动消除
     */
    AUTO_CANCEL("4", "自动消除"),
    /**
     * 其他
     */
    OTHER("5", "其他");

    private final String code;

    private final String desc;

    WorkAlarmDealType(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static WorkAlarmDealType getByCode(String code) {
        return Stream.of(WorkAlarmDealType.values()).filter(w -> w.getCode().equals(code)).findAny().orElse(null);
    }
}

